<?php
class ExamenVih extends AppModel {
	var $name = 'ExamenVih'; //PHP4 Compatibility
	var $primaryKey= 'examen_id'; //TODO: Añadir arco
	var $belongsTo = array('R850','R860','R870');
	var $validate = array();

	function beforeSave(){ //Implementación de arco en la herramienta
		if (
			(isset($this->data['ExamenVih']['r850_id']) && !isset($this->data['ExamenVih']['r860_id'])  && !isset($this->data['ExamenVih']['r870_id']))
			OR
			(!isset($this->data['ExamenVih']['r850_id']) && isset($this->data['ExamenVih']['r860_id'])  && !isset($this->data['ExamenVih']['r870_id']))
			OR
			(!isset($this->data['ExamenVih']['r850_id']) && !isset($this->data['ExamenVih']['r860_id'])  && isset($this->data['ExamenVih']['r870_id']))
			){
				if($this->data['ExamenVih']['fecha_del_examen']==0)unset($this->data['ExamenVih']['fecha_del_examen']);
				if($this->data['ExamenVih']['tipo_de_examen_vih']==0)unset($this->data['ExamenVih']['tipo_de_examen_vih']);
				if($this->data['ExamenVih']['resultado_general_del_examen']=="")unset($this->data['ExamenVih']['resultado_general_del_examen']);
				
				return true;
			}else{
				return false;
			}
	}
}
?>